from typing import List
from dto.strategy_info import StrategyInfoMetadata
from dto.strategy_assessment import RiskAssessment
from dto.strategy_info import StrategyInfoMetadata
from dto.strategy_stock_day import StrategyStockDay
from service.strategy.base_strategy import BaseStrategy
from service.strategy.base_week_strategy import BaseWeekStrategy


class StrategyPreHandler:

    def addCommonStockInfo(self, trade_info_list: List[StrategyStockDay]):
        """
        获取最后一个交易日的收盘价
        :param trade_info_list: 股票每日交易数据列表
        :return: 最后一个交易日的收盘价
        """

        if not trade_info_list:
            raise ValueError("The trade_info_list is empty.")

        # 按交易日期排序（确保正确的顺序）
        trade_info_list = sorted(trade_info_list, key=lambda x: x.trade_date)

        # 获取最后一条记录的收盘价
        last_trade_info = trade_info_list[-1]
        return last_trade_info.close
